This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local file = io.open("example.txt", "a") -- a for append, w for overwrite all | |
file:write("Dont think you are. Know you are.") | |
file:close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get the full path of the .exe, ANSI format | |
string ExePath() { | |
char buffer[MAX_PATH]; | |
GetModuleFileNameA( NULL, buffer, MAX_PATH ); | |
string::size_type pos = string( buffer ).find_last_of( "\\/" ); | |
return string( buffer ).substr( 0, pos); | |
} | |
// Check if file exists | |
bool IniFileExists(string file) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clock_t start = clock(); | |
for (int it = 0; it < 1000000; ++it) | |
foo(s); | |
printf("foo took %i cycles\n", clock() - start); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
watch "ls -lrt | tail -10" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create master file | |
dd if=/dev/zero of=masterfile bs=1 count=1000000 | |
# split master file | |
split -b 10 -a 10 masterfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#fadeout { | |
z-index: 50; | |
position: fixed; | |
left: 0; | |
top: 0; | |
right: 0; | |
height: 100px; | |
background: -webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 255)), to(rgba(255, 255, 255, 0))); | |
background: -moz-linear-gradient(top, rgba(255, 255, 255, 255), rgba(255, 255, 255, 0)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@divwith: 1600px; | |
.superdiv { | |
overflow: auto; | |
height: 100%; | |
position: absolute; | |
width: @divwith; | |
margin-left: -(@divwith/2); | |
left: 50%; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @ricardo.cc | |
# Multiply each item in a list by 2 | |
[1..10].map (i) -> i*2 | |
# or | |
i * 2 for i in [1..10] | |
# Sum a list of numbers | |
[1..1000].reduce (t, s) -> t + s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JSONObject obj = new JSONObject("{interests : [{interestKey:Dogs}, {interestKey:Cats}]}"); | |
List<String> list = new ArrayList<String>(); | |
JSONArray array = obj.getJSONArray("interests"); | |
for(int i = 0 ; i < array.length() ; i++){ | |
list.add(array.getJSONObject(i).getString("interestKey")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
public static volatile int x = 0; | |
public static void main(String[] args) { | |
LoopingThread t = new LoopingThread(); | |
t.start(); | |
while (true) { | |
x = x++; | |
} | |
} | |
} |
OlderNewer